package com.iflytek.springboot_medicine.service.impl;

import com.iflytek.springboot_medicine.common.Page;
import com.iflytek.springboot_medicine.entity.Operation;
import com.iflytek.springboot_medicine.mapper.OperationMapper;
import com.iflytek.springboot_medicine.service.OperationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OperationServiceImpl implements OperationService {

    @Autowired
    OperationMapper operationMapper;

    @Override
    public Page<Operation> selectOperations(Integer pageNum, Integer pageSize ) {
        Integer skipNum = (pageNum - 1) * pageSize; //计算出来
        Page<Operation> page = new Page<>();
        List<Operation> userList = operationMapper.selectBypage(skipNum,pageSize);
        Integer total =  operationMapper.selectCountByPage();
        page.setTotal(Long.valueOf(total));
        page.setList(userList);
        return  page;
    }


}
